#!/usr/bin/env python

from fulguro import *


imin = flgr2d_load_pgm("../../apps/images/gray/lena.pgm")
imout = FLGR_Data2D(imin)

iminf = FLGR_Data2D(imin.size_y, imin.size_x, imin.spp, FLGR_FLOAT64)
imoutf = FLGR_Data2D(iminf)

iminCplx = FLGR_Data2D(iminf.size_y, iminf.size_x, 2, iminf.type)
imfft = FLGR_Data2D(iminCplx)
imoutCplx = FLGR_Data2D(iminCplx)

flgr2d_copy(iminf,imin)

flgr2d_compose_channel(iminCplx, iminf, 1)
flgr2d_fft_forward_cplx(imfft,iminCplx)

flgr2d_fft_backward_cplx(imoutCplx,imfft)
flgr2d_extract_channel(imoutf,imoutCplx, 1)


flgr2d_histogram_normalize(imoutf,imoutf,0,255)
flgr2d_copy(imout,imoutf)


flgr_display(imin,imout)

